package 蓝桥杯.第十四届蓝桥杯大赛软件赛省赛Java大学B组;

import java.util.Scanner;

/**
 * @Title: 矩形总面积
 * @Author 贾金博
 * @Package 蓝桥杯.第十四届蓝桥杯大赛软件赛省赛Java大学B组
 * @Date 2024/4/9 18:55
 * @description:
 */
public class 矩形总面积 {
    public static void main(String[] args) {
        Scanner sc = new Scanner(System.in);
        long x1, y1, x2, y2;
        long x3, y3, x4, y4;
        x1 = sc.nextInt();
        y1 = sc.nextInt();
        x2 = sc.nextInt();
        y2 = sc.nextInt();

        x3 = sc.nextInt();
        y3 = sc.nextInt();
        x4 = sc.nextInt();
        y4 = sc.nextInt();

        //总的减去相交的
        long sum = Math.abs(Math.abs((x2 - x1) * (y2 - y1)) + Math.abs((x4 - x3) * (y4 - y3)));
        if(x3 >= x2 || x4 <= x1 || y3 >= y2 || y4 <= y1) {//不相交
            System.out.println(sum);
        } else  {
            long x = Math.max(x1, x3);
            long xx = Math.min(x2, x4);

            long y = Math.max(y1, y3);
            long yy = Math.min(y2, y4);

            long t = ( (xx - x) *  (yy - y));
            System.out.println(sum - t);
        }
    }
}
